#include <head.h>
void
mmap_test()
{
	int fd =open("mmap.txt",O_RDONLY|O_CREAT|O_TRUNC,0666);
	if(fd <0){
	    perror("create file");
		exit(1);
	}
	// lseek(fd,1024,SEEK_SET);
	// write(fd,"\0",1);
	
	char * const p = (char *)mmap(NULL,1024,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
	if(p == MAP_FAILED){
		perror("map ");
		exit(1);
	}

	char *s= p;
	memcpy(s,"hello world",11);

	munmap(p,1024);
	close(fd);

}
